<template>
	<div class="content">
        <div class='rata'>     
            <div class='rata_r'>
                <div class='top-rated'>
                    <p class='title'>近期最受期待</p>
                    <div class='top-rated-list'>
                        <div class='top-rated-item' v-for='item in preMovie' :key='item.id'>
                            <div class='poster default-img-bg'>
                                <img :src="item.img" alt="">
                                <span class='love'><span></span></span>
                                <span class='wish-bg'></span>
                                <span class='score'>{{item.wish}} 人想看</span>
                            </div>
                            <h5 class='name line-ellipsis'>{{item.nm}}</h5>
                            <div class='poster-pre-date'>{{item.comingTitle.split(' ')[0]}}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <ul class="list">
			<li v-for="(item,index) in preList" :key="item.id" class="item">
                <div class="comingTile">{{index==0?preList[index].comingTitle:preList[index].comingTitle!=preList[index-1].comingTitle?preList[index].comingTitle:""}}</div>
				<router-link :to="'/item/' + item.id">
					<div class="item_img"><img :src="item.img" /></div>
					<div class="item_text">
						<div class="layer_1">
							<span class="title">{{ item.nm }}</span>
							<span
								v-show="item.version.split(/\s+/)[0][0]"
								class="version"
								:class="item.version"
							></span>
						</div>
						<div class="item_content">
							<div v-if="item.globalReleased">
								<div v-if="item.sc != 0">
									<span>影评</span
									><span class="light_score">{{ item.sc }}</span>
								</div>
								<div v-else><span>暂无评分</span></div>
							</div>
							<div v-else>
								<span class="light_wish">{{ item.wish }}</span
								><span>人想看</span>
							</div>
							<div class="text-wrap">
								<span>主演</span><span class="star">{{ item.star }}</span>
							</div>
							<div>{{ item.showInfo }}</div>
						</div>
					</div>
					<div class="item_btn">
						<div v-if="item.showst>=4" class="btn ysbtn">预售</div>
						<div v-else class="btn wishbtn">想看</div>
					</div>
				</router-link>
			</li>
		</ul>
    </div>
</template>
<script>
import axios from "axios";
export default {
	name: "wait",
    data:function(){
        return {
            preMovie:[],
            preList:[]
        }
    },
	mounted() {
        //最受期待
		axios
			.get(
				"/ajax/mostExpected?ci=62&limit=10&offset=0&token=&optimus_uuid=689A5D80D8D611EBB79063E128DD6EEBEF880FE3D08F4A2D8F5969A1FDA61E2F&optimus_risk_level=71&optimus_code=10"
			)
			.then((res) => {
                this.preMovie=res.data.coming;
                //
                this.preMovie.forEach(element => {
                    element.img=element.img.replace('w.h','64.90');
                });
			});
		//待映列表
		axios
			.get(
				"/ajax/comingList?ci=62&token=&limit=10&optimus_uuid=689A5D80D8D611EBB79063E128DD6EEBEF880FE3D08F4A2D8F5969A1FDA61E2F&optimus_risk_level=71&optimus_code=10"
			)
			.then((res) => {
				console.log(res.data.coming);
                this.preList=res.data.coming;
                this.preList.forEach(item=>{
                    item.img=item.img.replace('w.h','64.90');
                })
			});
	},
};
</script>
